package com.neusoft.consumer.controller;

import com.neusoft.cloud02.domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class UserController {

    private static final String REST_URL_PREFIX = "http://localhost:8090";
    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/queryStu.do")
    public Student findStudent()
    {
       return restTemplate.getForObject(REST_URL_PREFIX+"/findStudent.do",Student.class);
    }

    @RequestMapping("/queryStuByid/{id}")
    public Student findStudent0001(@PathVariable("id") Integer id)
    {
        return restTemplate.getForObject(REST_URL_PREFIX+"/findStubyId/"+id,Student.class);
    }
}
